package main

import "fmt"

func remove(nums []int, n int) int {

	for i := 0; i < len(nums); i++ {
		if nums[i] == n {
			nums = append(nums[0:i], nums[i+1:]...)
			i--
		}
	}
	return len(nums)
}

func main() {
	nums := []int{2, 0, 1, 2, 2, 3, 0, 4, 2}
	i := remove(nums, 2)
	fmt.Println(i)
}
